package ExamSystemClient.managerSystem.studentManagement;

import ExamSystemClient.model.Student;
import ExamSystemClient.model.User;

import java.util.ArrayList;
import java.util.List;

/**
 * 学员信息管理抽象类
 *
 * @author huangshuxian
 */
public abstract class StudentInfoManage {
    /**
     * 学生信息列表
     */
    List<Student> studentInfos = new ArrayList<>();

    public StudentInfoManage(List<Student> studentInfos) {
        this.studentInfos = studentInfos;
    }

    /**
     * 信息管理抽象方法
     */
    public abstract void operate();

    /**
     * 打印操作信息
     */
    public abstract StudentInfoManage show();

    /**
     * 根据学号获得对应信息索引
     * @param number
     * @return
     */
    public int getIndexByNumber(int number){
        int index = -1;
        for (Student studentInfo : studentInfos) {
            if (studentInfo.getNumber() == number){
                index = studentInfos.indexOf(studentInfo);
                break;
            }
        }
        return index;
    }
}
